mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 22:41:31 +01:00
make self-update work on Linux
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
use std::process::Stdio;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
@@ -215,6 +213,10 @@ async fn serve_with_csa(
|
||||
csa: CodeServerArgs,
|
||||
shutdown_rx: Option<oneshot::Receiver<()>>,
|
||||
) -> Result<i32, AnyError> {
|
||||
// Intentionally read before starting the server. If the server updated and
|
||||
// respawn is requested, the old binary will get renamed, and then
|
||||
// current_exe will point to the wrong path.
|
||||
let current_exe = std::env::current_exe().unwrap();
|
||||
let platform = spanf!(log, log.span("prereq"), PreReqChecker::new().verify())?;
|
||||
|
||||
let auth = Auth::new(&paths, log.clone());
|
||||
@@ -244,11 +246,8 @@ async fn serve_with_csa(
|
||||
// reuse current args, but specify no-forward since tunnels will
|
||||
// already be running in this process, and we cannot do a login
|
||||
let args = std::env::args().skip(1).collect::<Vec<String>>();
|
||||
let exit = std::process::Command::new(std::env::current_exe().unwrap())
|
||||
let exit = std::process::Command::new(current_exe)
|
||||
.args(args)
|
||||
.stdout(Stdio::inherit())
|
||||
.stderr(Stdio::inherit())
|
||||
.stdin(Stdio::inherit())
|
||||
.spawn()
|
||||
.map_err(|e| wrap(e, "error respawning after update"))?
|
||||
.wait()
|
||||
|
||||
Reference in New Issue
Block a user