dwipe 1.0.3__tar.gz → 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dwipe-1.0.3/src/dwipe.egg-info → dwipe-1.0.4}/PKG-INFO +1 -1
- {dwipe-1.0.3 → dwipe-1.0.4}/pyproject.toml +1 -1
- {dwipe-1.0.3 → dwipe-1.0.4}/src/dwipe/main.py +49 -33
- {dwipe-1.0.3 → dwipe-1.0.4/src/dwipe.egg-info}/PKG-INFO +1 -1
- {dwipe-1.0.3 → dwipe-1.0.4}/LICENSE +0 -0
- {dwipe-1.0.3 → dwipe-1.0.4}/README.md +0 -0
- {dwipe-1.0.3 → dwipe-1.0.4}/setup.cfg +0 -0
- {dwipe-1.0.3 → dwipe-1.0.4}/src/dwipe/PowerWindow.py +0 -0
- {dwipe-1.0.3 → dwipe-1.0.4}/src/dwipe/__init__.py +0 -0
- {dwipe-1.0.3 → dwipe-1.0.4}/src/dwipe.egg-info/SOURCES.txt +0 -0
- {dwipe-1.0.3 → dwipe-1.0.4}/src/dwipe.egg-info/dependency_links.txt +0 -0
- {dwipe-1.0.3 → dwipe-1.0.4}/src/dwipe.egg-info/entry_points.txt +0 -0
- {dwipe-1.0.3 → dwipe-1.0.4}/src/dwipe.egg-info/requires.txt +0 -0
- {dwipe-1.0.3 → dwipe-1.0.4}/src/dwipe.egg-info/top_level.txt +0 -0
|
@@ -79,6 +79,7 @@ class WipeJob:
|
|
|
79
79
|
self.total_written = 0
|
|
80
80
|
self.wr_hists = [] # list of (mono, written)
|
|
81
81
|
self.done = False
|
|
82
|
+
self.exception = None # in case of issues
|
|
82
83
|
|
|
83
84
|
@staticmethod
|
|
84
85
|
def start_job(device_path, total_size, opts):
|
|
@@ -185,38 +186,43 @@ class WipeJob:
|
|
|
185
186
|
self.total_written = 0 # Track total bytes written
|
|
186
187
|
is_random = self.opts.random
|
|
187
188
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
189
|
+
try:
|
|
190
|
+
with open(self.device_path, 'wb') as device:
|
|
191
|
+
# for loop in range(10000000000):
|
|
192
|
+
offset = 0
|
|
193
|
+
chunk = memoryview(WipeJob.zero_buffer)
|
|
194
|
+
while True:
|
|
195
|
+
# foo = 1/0 # to force exception only
|
|
196
|
+
if self.do_abort:
|
|
197
|
+
break
|
|
198
|
+
if is_random:
|
|
199
|
+
offset = random.randint(0, WipeJob.BUFFER_SIZE - WipeJob.WRITE_SIZE)
|
|
200
|
+
# Use memoryview to avoid copying the data
|
|
201
|
+
chunk = memoryview(WipeJob.buffer)[offset:offset + WipeJob.WRITE_SIZE]
|
|
202
|
+
|
|
203
|
+
if self.opts.dry_run:
|
|
204
|
+
bytes_written = self.total_size // 120
|
|
205
|
+
time.sleep(0.25)
|
|
206
|
+
else:
|
|
207
|
+
try:
|
|
208
|
+
bytes_written = device.write(chunk)
|
|
209
|
+
except Exception:
|
|
210
|
+
bytes_written = 0
|
|
211
|
+
self.total_written += bytes_written
|
|
212
|
+
# Optional: Check for errors or incomplete writes
|
|
213
|
+
if bytes_written < WipeJob.WRITE_SIZE:
|
|
214
|
+
break
|
|
215
|
+
if self.opts.dry_run and self.total_written >= self.total_size:
|
|
216
|
+
break
|
|
217
|
+
# clear the beginning of device whether aborted or not
|
|
218
|
+
# if we have started writing + status in JSON
|
|
219
|
+
if not self.opts.dry_run and self.total_written > 0:
|
|
220
|
+
device.seek(0)
|
|
221
|
+
# chunk = memoryview(WipeJob.zero_buffer)
|
|
222
|
+
bytes_written = device.write(self.prep_marker_buffer(is_random))
|
|
223
|
+
except Exception:
|
|
224
|
+
self.exception = traceback.format_exc()
|
|
225
|
+
|
|
220
226
|
self.done = True
|
|
221
227
|
|
|
222
228
|
class DeviceInfo:
|
|
@@ -755,6 +761,8 @@ class DiskWipe:
|
|
|
755
761
|
line += ' Stop' if self.job_cnt > 0 else ''
|
|
756
762
|
line += f' quit ?:help /{self.prev_filter} Mode='
|
|
757
763
|
line += f'{"Random" if self.opts.random else "Zeros"}'
|
|
764
|
+
if self.opts.dry_run:
|
|
765
|
+
line += ' DRY-RUN'
|
|
758
766
|
# for action in self.actions:
|
|
759
767
|
# line += f' {action[0]}:{action}'
|
|
760
768
|
return line[1:]
|
|
@@ -834,9 +842,17 @@ class DiskWipe:
|
|
|
834
842
|
to='s' if partition.job.do_abort else 'W'
|
|
835
843
|
self.set_state(partition, to=to)
|
|
836
844
|
partition.dflt = to
|
|
837
|
-
partition.job = None
|
|
838
845
|
partition.mounts = []
|
|
839
846
|
self.job_cnt -= 1
|
|
847
|
+
if partition.job.exception:
|
|
848
|
+
self.win.stop_curses()
|
|
849
|
+
print('\n\n\n========== ALERT =========\n')
|
|
850
|
+
print(f' FAILED: wipe {repr(partition.name)}')
|
|
851
|
+
print(partition.job.exception)
|
|
852
|
+
input('\n\n===== Press ENTER to continue ====> ')
|
|
853
|
+
self.win._start_curses()
|
|
854
|
+
|
|
855
|
+
partition.job = None
|
|
840
856
|
if partition.job:
|
|
841
857
|
elapsed, pct, rate, until = partition.job.get_status()
|
|
842
858
|
partition.state = pct
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|