如何运行shell命令(例如。 cp ,即复制)从介子构建脚本?
cp
我试过这个代码:
r = run_command('cp', 'test.txt', 'test2.txt') if r.returncode() != 0 warning('Command failed') endif
但它什么也没做。 run_command 运行成功(返回0),但未复制文件。 内容提供商 具有 cp3 ,我从介子得到一个错误消息,进程终止,它甚至没有到达下一行。 如果我替换 test.txt test0.txt ,我从脚本中得到一条错误消息。
run_command
内容提供商
cp3
test.txt
test0.txt
是 运行\u命令
运行\u命令
参考文献: https://mesonbuild.com/External-commands.html
unspecified 目录,因此,请尝试指定完整的文件名,例如:
source = join_paths(meson.source_root(), 'test.txt') dest = join_paths(meson.build_root(), 'test2.txt') message('copying @0@ to @1@ ...'.format(source, dest)) r = run_command('cp', source, dest)