Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
c74ecf34
Commit
c74ecf34
authored
Apr 02, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #504: save config to rc_filename + "~new" and copy it on success
parent
2b00ea6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
pronsole.py
printrun/pronsole.py
+3
-2
No files found.
printrun/pronsole.py
View file @
c74ecf34
...
...
@@ -20,6 +20,7 @@ import glob
import
os
import
time
import
sys
import
shutil
import
subprocess
import
codecs
import
argparse
...
...
@@ -932,10 +933,9 @@ class pronsole(cmd.Cmd):
try
:
written
=
False
if
os
.
path
.
exists
(
self
.
rc_filename
):
import
shutil
shutil
.
copy
(
self
.
rc_filename
,
self
.
rc_filename
+
"~bak"
)
rci
=
codecs
.
open
(
self
.
rc_filename
+
"~bak"
,
"r"
,
"utf-8"
)
rco
=
codecs
.
open
(
self
.
rc_filename
,
"w"
,
"utf-8"
)
rco
=
codecs
.
open
(
self
.
rc_filename
+
"~new"
,
"w"
,
"utf-8"
)
if
rci
is
not
None
:
overwriting
=
False
for
rc_cmd
in
rci
:
...
...
@@ -956,6 +956,7 @@ class pronsole(cmd.Cmd):
if
rci
is
not
None
:
rci
.
close
()
rco
.
close
()
shutil
.
move
(
self
.
rc_filename
+
"~new"
,
self
.
rc_filename
)
# if definition != "":
# self.log("Saved '"+key+"' to '"+self.rc_filename+"'")
# else:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment