import cp from 'child_process' ; import surveyConfig from '../../config/survey_config' ; export function postSurveyResponsesInBackground ( ) { if ( surveyConfig . hasSurveyResponse ( ) ) { cp . spawn ( '/usr/bin/env' , [ 'node' , __filename ] , { detached : true , stdio : 'ignore' , } ) ; } } export async function postSurveyResponse ( ) { const responsePostedSuccessfully = await surveyConfig . postResponses ( ) ; if ( responsePostedSuccessfully ) { surveyConfig . clearPriorSurveyResponse ( ) ; } } if ( process . argv [ 1 ] === __filename ) { void postSurveyResponse ( ) ; }