在我的cmake文件中,我使用运行命令execute_process。我想检查一下是否失败。它不会打印任何内容stderr。
到目前为止,我一直在使用运行命令的bash脚本,然后使用来检查退出状态$? == 1。
有没有办法用cmake做类似的事情?
execute_process(COMMAND "runThis")
if("{$?}" EQUAL 1)
message( FATAL_ERROR "Bad exit status")
endif()
Run Code Online (Sandbox Code Playgroud)
我用cmake 3.12.1
我试图用 javaHttpServer类做一些事情。
这是文档中的最小示例:
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import com.sun.net.httpserver.HttpServer;
class MyHandler implements HttpHandler
{
public void handle(HttpExchange t) throws IOException
{
InputStream is = t.getRequestBody();
read(is); // .. read the request body
String response = "This is the response";
t.sendResponseHeaders(200, response.length());
OutputStream os = t.getResponseBody();
os.write(response.getBytes());
os.close();
}
}
public class Main
{
HttpServer server = HttpServer.create(new InetSocketAddress(8000));
server.createContext("/applications/myapp", new MyHandler());
server.setExecutor(null); // creates a default executor
server.start();
}
Run Code Online (Sandbox Code Playgroud)
但我收到此错误消息:
描述资源路径位置类型访问限制:类型'HttpServer'不是API(对所需库'/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/rt.jar'的限制) Main .java /test/src/test …
我正在编程 go,我想使用快捷方式运行gofmt并将当前源文件的内容替换为gofmt.
我在 vimrc 中定义了以下映射:
map <C-r> :r ! gofmt %<CR>但这只是将输出附加到当前文件。有没有办法覆盖它?
我尝试向所有新创建的用户添加属性"权限".但它不知何故不起作用.我使用此代码添加属性
Accounts.onCreateUser(function(options, user) {
user.permission = 'default';
if (options.profile)
user.profile = options.profile;
return user;
});
Run Code Online (Sandbox Code Playgroud)
但是当我在客户端检索用户对象时,我看不到该属性
u = Meteor.users.findOne(Meteor.userId)
u.permission
>undefined
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?