Skip to content

Commit c3f36c3

Browse files
committed
grml2usb: "handle_syslinux_config": use with open instead of f.close()
1 parent bb8bb57 commit c3f36c3

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

grml2usb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,14 +1580,12 @@ def handle_syslinux_config(grml_flavour, target, bootid):
15801580
syslinux_cfg = syslinux_target + "syslinux.cfg"
15811581

15821582
# install main configuration only *once*, no matter how many ISOs we have:
1583-
syslinux_config_file = open(syslinux_cfg, "w")
1584-
syslinux_config_file.write("timeout 300\n")
1585-
syslinux_config_file.write("include vesamenu.cfg\n")
1586-
syslinux_config_file.close()
1587-
1588-
prompt_name = open(syslinux_target + "promptname.cfg", "w")
1589-
prompt_name.write("menu label S^yslinux prompt\n")
1590-
prompt_name.close()
1583+
with open(syslinux_cfg, "w") as syslinux_config_file:
1584+
syslinux_config_file.write("timeout 300\n")
1585+
syslinux_config_file.write("include vesamenu.cfg\n")
1586+
1587+
with open(syslinux_target + "promptname.cfg", "w") as prompt_name:
1588+
prompt_name.write("menu label S^yslinux prompt\n")
15911589

15921590
initial_syslinux_config(syslinux_target)
15931591
flavour_filename = get_flavour_filename(grml_flavour)

0 commit comments

Comments
 (0)