mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Fixes stderr appearing to have content when it doesn't
This commit is contained in:
		@@ -149,6 +149,9 @@ which will in turn call `pdf2pdfocr.py`_ on your document, which will then
 | 
				
			|||||||
overwrite the file with an OCR'd version of the file and exit.  At which point,
 | 
					overwrite the file with an OCR'd version of the file and exit.  At which point,
 | 
				
			||||||
the consumption process will begin with the newly modified file.
 | 
					the consumption process will begin with the newly modified file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The script's stdout and stderr will be logged line by line to the webserver log, along
 | 
				
			||||||
 | 
					with the exit code of the script.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. _pdf2pdfocr.py: https://github.com/LeoFCardoso/pdf2pdfocr
 | 
					.. _pdf2pdfocr.py: https://github.com/LeoFCardoso/pdf2pdfocr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. _advanced-post_consume_script:
 | 
					.. _advanced-post_consume_script:
 | 
				
			||||||
@@ -178,6 +181,10 @@ example, you can take a look at `post-consumption-example.sh`_ in this project.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
The post consumption script cannot cancel the consumption process.
 | 
					The post consumption script cannot cancel the consumption process.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The script's stdout and stderr will be logged line by line to the webserver log, along
 | 
				
			||||||
 | 
					with the exit code of the script.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Docker
 | 
					Docker
 | 
				
			||||||
------
 | 
					------
 | 
				
			||||||
Assumed you have ``/home/foo/paperless-ngx/scripts/post-consumption-example.sh``.
 | 
					Assumed you have ``/home/foo/paperless-ngx/scripts/post-consumption-example.sh``.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -537,11 +537,19 @@ class Consumer(LoggingMixin):
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Decode the output (if any)
 | 
					        # Decode the output (if any)
 | 
				
			||||||
        stdout_str = completed_process.stdout.decode("utf8", errors="ignore").split(
 | 
					        stdout_str = (
 | 
				
			||||||
            "\n",
 | 
					            completed_process.stdout.decode("utf8", errors="ignore")
 | 
				
			||||||
 | 
					            .strip()
 | 
				
			||||||
 | 
					            .split(
 | 
				
			||||||
 | 
					                "\n",
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        stderr_str = completed_process.stderr.decode("utf8", errors="ignore").split(
 | 
					        stderr_str = (
 | 
				
			||||||
            "\n",
 | 
					            completed_process.stderr.decode("utf8", errors="ignore")
 | 
				
			||||||
 | 
					            .strip()
 | 
				
			||||||
 | 
					            .split(
 | 
				
			||||||
 | 
					                "\n",
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if len(stdout_str):
 | 
					        if len(stdout_str):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user