Set the working directory according to the editor file path (#14688)
Kernels now launch in the same directory as the script invoking them, similar to notebook behavior.  Release Notes: - N/A
This commit is contained in:
parent
f5f4578422
commit
ba4fa17b83
4 changed files with 52 additions and 17 deletions
|
@ -171,6 +171,7 @@ pub struct RunningKernel {
|
|||
_control_task: Task<anyhow::Result<()>>,
|
||||
_routing_task: Task<anyhow::Result<()>>,
|
||||
connection_path: PathBuf,
|
||||
pub working_directory: PathBuf,
|
||||
pub request_tx: mpsc::Sender<JupyterMessage>,
|
||||
pub execution_state: ExecutionState,
|
||||
pub kernel_info: Option<KernelInfoReply>,
|
||||
|
@ -190,6 +191,7 @@ impl RunningKernel {
|
|||
pub fn new(
|
||||
kernel_specification: KernelSpecification,
|
||||
entity_id: EntityId,
|
||||
working_directory: PathBuf,
|
||||
fs: Arc<dyn Fs>,
|
||||
cx: &mut AppContext,
|
||||
) -> Task<anyhow::Result<(Self, JupyterMessageChannel)>> {
|
||||
|
@ -220,7 +222,9 @@ impl RunningKernel {
|
|||
fs.atomic_write(connection_path.clone(), content).await?;
|
||||
|
||||
let mut cmd = kernel_specification.command(&connection_path)?;
|
||||
|
||||
let process = cmd
|
||||
.current_dir(&working_directory)
|
||||
// .stdout(Stdio::null())
|
||||
// .stderr(Stdio::null())
|
||||
.kill_on_drop(true)
|
||||
|
@ -301,6 +305,7 @@ impl RunningKernel {
|
|||
Self {
|
||||
process,
|
||||
request_tx,
|
||||
working_directory,
|
||||
_shell_task,
|
||||
_iopub_task,
|
||||
_control_task,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue