Skip to content

Commit dd4ce1c

Browse files
committed
Create stdout/stderr files only when there's actual content
1 parent a37a4df commit dd4ce1c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

jupyter_scheduler/python_executor.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ def execute(self):
3333
env=env,
3434
)
3535

36-
# Write stdout/stderr to staging_paths (keys match output_formats)
37-
with fsspec.open(self.staging_paths["stdout"], "w", encoding="utf-8") as f:
38-
f.write(result.stdout)
39-
with fsspec.open(self.staging_paths["stderr"], "w", encoding="utf-8") as f:
40-
f.write(result.stderr)
36+
# Only write stdout/stderr if there's content
37+
if result.stdout:
38+
with fsspec.open(self.staging_paths["stdout"], "w", encoding="utf-8") as f:
39+
f.write(result.stdout)
40+
if result.stderr:
41+
with fsspec.open(self.staging_paths["stderr"], "w", encoding="utf-8") as f:
42+
f.write(result.stderr)
4143

4244
# Capture any additional side effect files AFTER writing stdout/stderr
4345
self.add_side_effects_files(staging_dir)

0 commit comments

Comments
 (0)