1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: deprecate os.exec (returning ?os.Result), in favour of os.execute, which returns os.Result (#8974)

This commit is contained in:
Delyan Angelov
2021-03-08 20:52:13 +02:00
committed by GitHub
parent 10c9f61d61
commit d7049ae2da
52 changed files with 423 additions and 344 deletions

View File

@ -35,8 +35,9 @@ pub fn get_cursor_position() Coord {
}
// TODO: use termios.h, C.tcgetattr & C.tcsetattr directly,
// instead of using `stty`
oldsettings := os.exec('stty -g') or {
os.Result{}
mut oldsettings := os.execute('stty -g')
if oldsettings.exit_code < 0 {
oldsettings = os.Result{}
}
os.system('stty -echo -icanon time 0')
print('\033[6n')
@ -91,7 +92,9 @@ pub fn set_terminal_title(title string) bool {
if is_atty(1) <= 0 || os.getenv('TERM') == 'dumb' {
return true
}
print('\033]0;${title}\007')
print('\033]0')
print(title)
print('\007')
return true
}