fix(custom): check exist_status in endless script before clean the output
This commit is contained in:
		
							parent
							
								
									3e18673451
								
							
						
					
					
						commit
						0c9edb0c4b
					
				|  | @ -53,14 +53,17 @@ void waybar::modules::Custom::continuousWorker() | ||||||
|     char* buff = nullptr; |     char* buff = nullptr; | ||||||
|     size_t len = 0; |     size_t len = 0; | ||||||
|     if (getline(&buff, &len, fp_) == -1) { |     if (getline(&buff, &len, fp_) == -1) { | ||||||
|  |       int exit_code = 1; | ||||||
|       if (fp_) { |       if (fp_) { | ||||||
|         pclose(fp_); |         exit_code = WEXITSTATUS(pclose(fp_)); | ||||||
|         fp_ = nullptr; |         fp_ = nullptr; | ||||||
|       } |       } | ||||||
|       thread_.stop(); |       thread_.stop(); | ||||||
|       output_ = { 1, "" }; |       if (exit_code != 0) { | ||||||
|       std::cerr << name_ + " just stopped, is it endless?" << std::endl; |         output_ = { exit_code, "" }; | ||||||
|         dp.emit(); |         dp.emit(); | ||||||
|  |         std::cerr << name_ + " just stopped unexpectedly, is it endless?" << std::endl; | ||||||
|  |       } | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue