为 g++ build 设置超时,为 Sublime Text 运行?
Set timeout for g++ build and run for Sublime Text?
我在 ubuntu 上的 Sublime Text 3 上使用 g++,用于构建和运行我的 c++ 程序。构建系统当前如下所示:
{
"cmd" : ["g++ -std=c++14 -Wall $file_name -o $file_base_name && timeout 4s ./$file_base_name<input.txt>output.txt"],
"selector" : "source.c",
"shell": true,
"working_dir" : "$file_path",
}
正如您在第一行中看到的,超时设置为 4 秒,但是如果我不小心运行了无限循环,超时不起作用,Sublime 只是挂断。我在这里做错了什么?
这是我的 cpp 构建系统,文本精美。由于它是 mac,我已经安装了 coreutils 并使用了 mac 风格的gtimeout
命令。我的设置将在 7 秒后终止程序。
{
"cmd": ["g++ -o ${file_path}/${file_base_name} -lm -std=c++17 $file && gtimeout 7 ${file_path}/${file_base_name} && rm ${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.cpp, source.c++",
// "path": "C:/cygwin64/bin",
"shell": true,
"variants": [
{
"name": "Build",
"cmd": ["g++ -o ${file_path}/${file_base_name} -lm -std=c++17 $file && rm ${file_path}/${file_base_name}"]
}
]
}
相关文章:
- 运行同一解决方案的另一个项目的项目
- CMake-按正确顺序将项目与C运行时对象文件链接
- 如何运行位于boost/libs/python/example/tutorial目录中的hello.cpp和Jamfil
- 代码在main()中运行,但在函数中出现错误
- 我在c++代码中生成了一个运行时#3异常
- 如何在linux终端中同时编译和运行c++代码
- 为什么在运行时没有向我们提供有关分段错误的更多信息?
- 如何在运行中期切换GTK CSS style_context
- 如何在MS Visual Studio 2019中运行QT UI
- 如何通过cpp程序运行shell脚本
- IPC使用多个管道和分支进程来运行Python程序
- 删除指向指针的指针是运行时错误吗
- 为 g++ build 设置超时,为 Sublime Text 运行?
- 在 Mac OSX 上运行 Sublime Text 3 中的 C++
- 在Sublime Text 2中运行cpp文件
- 如何在Sublime Text 2,Windows 8中构建和运行C 程序
- 如何在Windows系统中使用Sublime Text在外部控制台中运行程序
- Sublime Text 2运行c++ 11代码
- 运行c++文件,输入Sublime Text 2
- 在Sublime Text 2中编译和运行c++