2017-10-26 12 views
1

バックグラウンドでpub getを実行しても、それを終了したプロセスが終了した場合は無視されます。このようなもの:Dartでexit-independentコードを実行するにはどうすればよいですか?

// ... pubspec.yaml code changes 
executeInBackground("pub get"); //async call, returns a Future 
exit(0); 

Process.runSync()ブロッキングコールを使用せずにどうすればよいですか? (私はプログラムができるだけ早く終了したい)

答えて

1

Process.start docとそのmodeパラメータを参照してください。

import 'dart:io'; 

main() async { 
    final p = await Process.start(
    'pub', 
    ['get'], 
    runInShell: true, 
    mode: ProcessStartMode.DETACHED, //all the magic is here 
); 
    print(p.pid); 
} 
+0

ありがとうございました! :-D –

関連する問題