Install builder cannot replace a currently executing binary on Linux - close #112
This commit is contained in:
parent
48d9273cc6
commit
5378afb6f8
6
build_tests/install_running_exe/Rsconscript
Normal file
6
build_tests/install_running_exe/Rsconscript
Normal file
@ -0,0 +1,6 @@
|
||||
build do
|
||||
Environment.new do |env|
|
||||
env.Program("program.exe", "program.c")
|
||||
env.Install("install/program.exe", "program.exe")
|
||||
end
|
||||
end
|
8
build_tests/install_running_exe/program.c
Normal file
8
build_tests/install_running_exe/program.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
sleep(2);
|
||||
return 0;
|
||||
}
|
@ -57,6 +57,7 @@ module Rscons
|
||||
printed_message = true
|
||||
end
|
||||
@cache.mkdir_p(File.dirname(dest), install: @install_builder)
|
||||
FileUtils.rm_f(dest)
|
||||
FileUtils.cp(src, dest, :preserve => true)
|
||||
end
|
||||
@cache.register_build(dest, :Copy, [src], @env, install: @install_builder)
|
||||
|
@ -337,6 +337,20 @@ EOF
|
||||
expect(result.stderr).to match /Could not find a registered build target "foo"/
|
||||
end
|
||||
|
||||
it "allows replacing a running executable when performing an 'install' operation" do
|
||||
test_dir("install_running_exe")
|
||||
result = run_rscons(op: "install")
|
||||
expect(result.stderr).to eq ""
|
||||
fcontents = File.read("program.c", mode: "rb")
|
||||
File.open("program.c", "wb") do |fh|
|
||||
fh.write(fcontents.sub(/2/, '3'))
|
||||
end
|
||||
pid = Process.spawn("install/program.exe")
|
||||
result = run_rscons(op: "install")
|
||||
expect(result.stderr).to eq ""
|
||||
Process.wait(pid)
|
||||
end
|
||||
|
||||
context "clean operation" do
|
||||
it 'cleans built files' do
|
||||
test_dir("simple")
|
||||
|
Loading…
x
Reference in New Issue
Block a user