File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
src/instrumentman/datatransfer Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 4040 help = "close transfer automatically upon timeout or when EOF is received" ,
4141 default = True
4242)
43+ @option (
44+ "--inclide-eof/--no-include-eof" ,
45+ help = (
46+ "wether the EOF marker is part of the output format "
47+ "(or just sent by the instrument regardless of the format in question)"
48+ ),
49+ default = False
50+ )
4351def cli_download (** kwargs : Any ) -> None :
4452 """Receive data sent from the instrument."""
4553 from .app import main_download
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ def main_download(
1313 timeout : int = 2 ,
1414 output : BufferedWriter | None = None ,
1515 eof : str = "" ,
16- autoclose : bool = True
16+ autoclose : bool = True ,
17+ include_eof : bool = False
1718) -> None :
1819 eof_bytes = eof .encode ("ascii" )
1920 with open_serial (
@@ -27,6 +28,11 @@ def main_download(
2728 try :
2829 data = com .receive_binary ()
2930 started = True
31+
32+ if data == eof_bytes and autoclose and not include_eof :
33+ echo_green ("Download finished (end-of-file)" )
34+ return
35+
3036 echo (data .decode ("ascii" , "replace" ))
3137 if output is not None :
3238 output .write (data + eol_bytes )
You can’t perform that action at this time.
0 commit comments