I recently asked this question: Import synced OneDrive files but no clear answer was given, although it made me look more into using the shell()
command.
I am trying to do the following:
observe({
invalidateLater(60*1000, session)
shell("cd C:/Users/xxx/AppData/Local/Microsoft/OneDrive && onedrive.exe /reset")
shell("cd C:/Users/xxx/AppData/Local/Microsoft/OneDrive && onedrive.exe")
list <- list.files(path = "../../folder/folder", pattern = ".xlsx", recursive = T)
...
})
The idea behind this is to force shutdown OneDrive and restart it to force a fresh sync that doesn't require physically opening the file.
Using the first shell command, OneDrive closes really quickly. However, on the second command my R gets stuck. It will show me the following messages:
[OneAuth:Error:9zj9x:00000000-0000-0000-0000-000000000000] OneAuth is not configured
[OneAuth:Error:9zj9x:00000000-0000-0000-0000-000000000000] OneAuth is not configured
[OneAuth:Info:9zkae:xxx] Start task AcquireCredentialSilently [0]
[OneAuth:Info:9zkad:xxx] Finish task AcquireCredentialSilently [0]
[OneAuth:Info:9zkae:xxx] Start task AcquireCredentialSilently [1]
[OneAuth:Info:9zkad:xxx] Finish task AcquireCredentialSilently [1]
[OneAuth:Info:9zkae:xxx] Start task AcquireCredentialSilently [2]
[OneAuth:Info:9zkad:xxx] Finish task AcquireCredentialSilently [2]
[OneAuth:Info:9zkae:xxx] Start task AcquireCredentialSilently [3]
[OneAuth:Info:9zkad:xxx] Finish task AcquireCredentialSilently [3]
[OneAuth:Info:9zkae:xxx] Start task AcquireCredentialSilently [4]
[OneAuth:Info:9zkad:xxx] Finish task AcquireCredentialSilently [4]
[OneAuth:Info:9zkae:xxx] Start task AcquireCredentialSilently [5]
[OneAuth:Info:9zkad:xxx] Finish task AcquireCredentialSilently [5]
[OneAuth:Info:9zkae:xxx] Start task AcquireCredentialSilently [6]
[OneAuth:Info:9zkad:xxx] Finish task AcquireCredentialSilently [6]
[OneAuth:Info:9zkae:xxx] Start task AcquireCredentialSilently [7]
[OneAuth:Info:9zkad:xxx] Finish task AcquireCredentialSilently [7]
[OneAuth:Info:9zkae:xxx] Start task AcquireCredentialSilently [8]
[OneAuth:Info:9zkad:xxx] Finish task AcquireCredentialSilently [8]
[OneAuth:Info:9zkae:xxx] Start task AcquireCredentialSilently [9]
[OneAuth:Info:9zkad:xxx] Finish task AcquireCredentialSilently [9]
[OneAuth:Info:9zkae:xxx] Start task AcquireCredentialSilently [10]
[OneAuth:Info:9zkad:xxx] Finish task AcquireCredentialSilently [10]
I can see that the files are syncing in OneDrive but even when all files are said to be synced the R process is not halting. When I try to close the process it tells me:
Child process not responding. R will terminate it
Are there any solutions for this? I also wonder what causes this issue in the first place.
CodePudding user response:
Seemingly answered by putting wait = F
in the shell
function like so:
shell("cd C:/Users/xxx/AppData/Local/Microsoft/OneDrive && onedrive.exe", wait = F)
This way starting OneDrive will be a background process instead not starting a child process. If you want to make sure the rest of the code runs only after OneDrive has fully resynced you can play around with Sys.sleep()
. Additionally, make sure your invalidateLater
timer is large enough to not reset OneDrive during a sync