liske/needrestart

needrestart output in noninteractive mode

Opened this issue · 1 comments

If you turn on DEBIAN_FRONTEND=noninteractive needrestart does still output this "Scanning process" progress bar:

Scanning processes... [                                                        ]
Scanning processes... [                                                        ]
Scanning processes... [                                                        ]
Scanning processes... [=                                                       ]
Scanning processes... [=                                                       ]
Scanning processes... [==                                                      ]
Scanning processes... [==                                                      ]
Scanning processes... [===                                                     ]
Scanning processes... [===                                                     ]
Scanning processes... [====                                                    ]
Scanning processes... [====                                                    ]
Scanning processes... [====                                                    ]
Scanning processes... [=====                                                   ]
Scanning processes... [=====                                                   ]
Scanning processes... [======                                                  ]
Scanning processes... [======                                                  ]
Scanning processes... [=======                                                 ]
Scanning processes... [=======                                                 ]
Scanning processes... [========                                                ]
Scanning processes... [========                                                ]
Scanning processes... [=========                                               ]
Scanning processes... [=========                                               ]
Scanning processes... [=========                                               ]
Scanning processes... [==========                                              ]
Scanning processes... [==========                                              ]
Scanning processes... [===========                                             ]
Scanning processes... [===========                                             ]
Scanning processes... [============                                            ]
Scanning processes... [============                                            ]
Scanning processes... [=============                                           ]
Scanning processes... [=============                                           ]
Scanning processes... [==============                                          ]
Scanning processes... [==============                                          ]
Scanning processes... [==============                                          ]
Scanning processes... [===============                                         ]
Scanning processes... [===============                                         ]
Scanning processes... [================                                        ]
Scanning processes... [================                                        ]
Scanning processes... [=================                                       ]
Scanning processes... [=================                                       ]
Scanning processes... [==================                                      ]
Scanning processes... [==================                                      ]
Scanning processes... [==================                                      ]
Scanning processes... [===================                                     ]
Scanning processes... [===================                                     ]
Scanning processes... [====================                                    ]
Scanning processes... [====================                                    ]
Scanning processes... [=====================                                   ]
Scanning processes... [=====================                                   ]
Scanning processes... [======================                                  ]
Scanning processes... [======================                                  ]
Scanning processes... [=======================                                 ]
Scanning processes... [=======================                                 ]
Scanning processes... [=======================                                 ]
Scanning processes... [========================                                ]
Scanning processes... [========================                                ]
Scanning processes... [=========================                               ]
Scanning processes... [=========================                               ]
Scanning processes... [==========================                              ]
Scanning processes... [==========================                              ]
Scanning processes... [===========================                             ]
Scanning processes... [===========================                             ]
Scanning processes... [============================                            ]
Scanning processes... [============================                            ]
Scanning processes... [============================                            ]
Scanning processes... [=============================                           ]
Scanning processes... [=============================                           ]
Scanning processes... [==============================                          ]
Scanning processes... [==============================                          ]
Scanning processes... [===============================                         ]
Scanning processes... [===============================                         ]
Scanning processes... [================================                        ]
Scanning processes... [================================                        ]
Scanning processes... [================================                        ]
Scanning processes... [=================================                       ]
Scanning processes... [=================================                       ]
Scanning processes... [==================================                      ]
Scanning processes... [==================================                      ]
Scanning processes... [===================================                     ]
Scanning processes... [===================================                     ]
Scanning processes... [====================================                    ]
Scanning processes... [====================================                    ]
Scanning processes... [=====================================                   ]
Scanning processes... [=====================================                   ]
Scanning processes... [=====================================                   ]
Scanning processes... [======================================                  ]
Scanning processes... [======================================                  ]
Scanning processes... [=======================================                 ]
Scanning processes... [=======================================                 ]
Scanning processes... [========================================                ]
Scanning processes... [========================================                ]
Scanning processes... [=========================================               ]
Scanning processes... [=========================================               ]
Scanning processes... [==========================================              ]
Scanning processes... [==========================================              ]
Scanning processes... [==========================================              ]
Scanning processes... [===========================================             ]
Scanning processes... [===========================================             ]
Scanning processes... [============================================            ]
Scanning processes... [============================================            ]
Scanning processes... [=============================================           ]
Scanning processes... [=============================================           ]
Scanning processes... [==============================================          ]
Scanning processes... [==============================================          ]
Scanning processes... [==============================================          ]
Scanning processes... [===============================================         ]
Scanning processes... [===============================================         ]
Scanning processes... [================================================        ]
Scanning processes... [================================================        ]
Scanning processes... [=================================================       ]
Scanning processes... [=================================================       ]
Scanning processes... [==================================================      ]
Scanning processes... [==================================================      ]
Scanning processes... [===================================================     ]
Scanning processes... [===================================================     ]
Scanning processes... [===================================================     ]
Scanning processes... [====================================================    ]
Scanning processes... [====================================================    ]
Scanning processes... [=====================================================   ]
Scanning processes... [=====================================================   ]
Scanning processes... [======================================================  ]
Scanning processes... [======================================================  ]
Scanning processes... [======================================================= ]
Scanning processes... [======================================================= ]
Scanning processes... [========================================================]
Scanning processes...                                                           
Scanning linux images... [                                                     ]
Scanning linux images... [=====================================================]
Scanning linux images...                                                        

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.
Exit status: 0

In case, needrestart or the apt-get upgrade hook to run needrestart is started within a script or remote execution job, you would see the output as above. Wouldn't it be better to prevent the progress bar? Is this somehow already implemented with a special flag or environment var you need to set?

needrestart only prints the progress bar if stderr is a terminal

Are you observing this issue in some automation implementation lacking a real terminal implementation?