tools: use os.symlink instead of system('ln -s') in `v symlink` (#10769)
parent
0a66d8dc10
commit
fe65cde03b
|
@ -31,11 +31,10 @@ fn setup_symlink_unix(vexe string) {
|
||||||
}
|
}
|
||||||
link_path = link_dir + '/v'
|
link_path = link_dir + '/v'
|
||||||
}
|
}
|
||||||
ret := os.execute('ln -sf "$vexe" "$link_path"')
|
os.rm(link_path) or {}
|
||||||
if ret.exit_code == 0 {
|
os.symlink(vexe, link_path) or {
|
||||||
println('Symlink "$link_path" has been created')
|
|
||||||
} else {
|
|
||||||
eprintln('Failed to create symlink "$link_path". Try again with sudo.')
|
eprintln('Failed to create symlink "$link_path". Try again with sudo.')
|
||||||
|
exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ fn test_is_file() {
|
||||||
assert true
|
assert true
|
||||||
} $else {
|
} $else {
|
||||||
dsymlink := os.join_path(work_dir, 'dir_symlink')
|
dsymlink := os.join_path(work_dir, 'dir_symlink')
|
||||||
os.system('ln -s $work_dir $dsymlink')
|
os.symlink(work_dir, dsymlink) or { panic(err) }
|
||||||
assert os.is_file(dsymlink) == false
|
assert os.is_file(dsymlink) == false
|
||||||
}
|
}
|
||||||
// Test file symlinks
|
// Test file symlinks
|
||||||
|
@ -119,7 +119,7 @@ fn test_is_file() {
|
||||||
assert true
|
assert true
|
||||||
} $else {
|
} $else {
|
||||||
fsymlink := os.join_path(work_dir, 'file_symlink')
|
fsymlink := os.join_path(work_dir, 'file_symlink')
|
||||||
os.system('ln -s $tfile $fsymlink')
|
os.symlink(tfile, fsymlink) or { panic(err) }
|
||||||
assert os.is_file(fsymlink)
|
assert os.is_file(fsymlink)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue