Skip to content

Commit 7a4f691

Browse files
committed
delete outputDir when it has been created
1 parent 2d389f9 commit 7a4f691

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/code/PublishHelper.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ internal void PushResource(string Repository, string modulePrefix, bool SkipDepe
455455
GetPackageInfoFromNupkg(nupkgFilePath: copiedNupkgFilePath, errRecord: out ErrorRecord pkgInfoErrRecord);
456456
if (pkgInfoErrRecord != null)
457457
{
458-
_cmdletPassedIn.WriteError(copyErrRecord);
458+
_cmdletPassedIn.WriteError(pkgInfoErrRecord);
459459
return;
460460
}
461461
}
@@ -492,7 +492,8 @@ internal void PushResource(string Repository, string modulePrefix, bool SkipDepe
492492
}
493493
finally
494494
{
495-
if (!_isNupkgPathSpecified)
495+
// For scenarios such as Publish-PSResource -NupkgPath -Repository <non-container registry repository>, the outputNupkgDir will be set to NupkgPath path, and a temp outputDir folder will not have been created and thus doesn't need to attempt to be deleted
496+
if (Directory.Exists(outputDir))
496497
{
497498
_cmdletPassedIn.WriteVerbose(string.Format("Deleting temporary directory '{0}'", outputDir));
498499
Utils.DeleteDirectory(outputDir);

0 commit comments

Comments
 (0)